import { GATEWAY_IP, PORT } from './address'
import httpRequest from '../utils/httpRequest'
/**
 * 
 * 获取验证码
 * 
 * @param {*} phone 
 */
export const getCode = (phone,type) => {
    return new Promise((resolve,reject) => {
        httpRequest({
            url : `http://${GATEWAY_IP}:${PORT}/gateway/aliyun/send/${phone}?type=${type}`,
            method : 'get',
        }).then(res => {
            resolve(res.data)
        }).catch(err => {
            reject(err)
        })
    })
}
/**
 * OSS上传
 * 
 */
export function policy() {
    return  new Promise((resolve,reject)=>{
        httpRequest({
             url: `http://${GATEWAY_IP}:${PORT}/gateway/aliyun/oss/policy`,
             method: "get",
         }).then(({ data }) => {
             resolve(data);
         })
     });
 }